package List.map;

import java.util.TreeMap;

/**
 * @author yangwenqi
 * @decs TODO
 * @date 2025/5/4
 * 作业1 输入一个字符串中，统计每个字符出现次数
 */
public class Test01 {
    public static void main(String[] args) {
        String s = "jahsdhgaskdiiisasjka";
        TreeMap<Character,Integer> tm = new TreeMap<>();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if(tm.containsKey(c)){
                int count = tm.get(c);
                count++;
                tm.put(c,count);
            }else{
                tm.put(c,1);
            }
        }
        System.out.println(tm);
    }
}
